<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basepath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>合同录入</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=no" name="format-detection" />
    <link href="<%=basepath%>css/index.css" rel="stylesheet" type="text/css">
    <link href="<%=basepath%>css/platform.css" rel="stylesheet" type="text/css">
    <script src="<%=basepath%>js/jquery-1.8.3.min.js"></script>
    <script src="<%=basepath%>js/layer/layer.js"></script>
    <!--mobiscrol-->
    <script src="<%=basepath%>js/dev/js/mobiscroll.core-2.5.2.js" type="text/javascript"></script>
    <script src="<%=basepath%>js/dev/js/mobiscroll.core-2.5.2-zh.js" type="text/javascript"></script>
    <link href="<%=basepath%>js/dev/css/mobiscroll.core-2.5.2.css" rel="stylesheet" type="text/css" />
    <link href="<%=basepath%>js/dev/css/mobiscroll.animation-2.5.2.css" rel="stylesheet" type="text/css" />
    <script src="<%=basepath%>js/dev/js/mobiscroll.datetime-2.5.1.js" type="text/javascript"></script>
    <script src="<%=basepath%>js/dev/js/mobiscroll.datetime-2.5.1-zh.js" type="text/javascript"></script>
    <!--ios-->
    <script src="<%=basepath%>js/dev/js/mobiscroll.ios-2.5.1.js" type="text/javascript"></script>
    <link href="<%=basepath%>js/dev/css/mobiscroll.ios-2.5.1.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(function () {
            var currYear = new Date().getFullYear();
            $('#demo').mobiscroll().date({
                theme: 'ios',
                lang: 'zh',
                display: 'bottom',
                dateFormat: 'yyyy-mm-dd', // 日期格式
                dateOrder: 'yymmdd', //面板中日期排列格式
                defaultValue: new Date(new Date().setFullYear(currYear - 20)),
                maxDate: new Date(new Date().setFullYear(currYear + 100)),
                minDate: new Date(new Date().setFullYear(currYear - 10))
            });
            $('#demo2').mobiscroll().date({
                theme: 'ios',
                lang: 'zh',
                display: 'bottom',
                dateFormat: 'yyyy-mm-dd', // 日期格式
                dateOrder: 'yymmdd', //面板中日期排列格式
                defaultValue: new Date(new Date().setFullYear(currYear - 20)),
                maxDate: new Date(new Date().setFullYear(currYear + 100)),
                minDate: new Date(new Date().setFullYear(currYear - 10))
            });
            $('#demo3').mobiscroll().date({
                theme: 'ios',
                lang: 'zh',
                display: 'bottom',
                dateFormat: 'yyyy-mm-dd', // 日期格式
                dateOrder: 'yymmdd', //面板中日期排列格式
                defaultValue: new Date(new Date().setFullYear(currYear - 20)),
                maxDate: new Date(new Date().setFullYear(currYear + 100)),
                minDate: new Date(new Date().setFullYear(currYear - 10))
            });
        });
    </script>
</head>
<body>
<div class="viewport">
    <div class="header">
       <div class="header-1">
           <a href="javascrpt:void(0)" id="join" class="header-2">
              <span id="account" class="account">${empty user.realName ? '' : user.realName}</span>&nbsp;&nbsp;<span id="deptName" class="deptName">${user.departmentName}</span>
           </a>
           <a href="/wape-web/api/core/centerService?serviceCode=WJ9999&targetURL=store&prefix=3g_platform_shop-rent_op&entrance=yes" class="back" id="back">返回</a>
           <span class="span-num">WWP33100</span>
       </div>
    </div>
    <div class="content m-top">
        <div class="sr-1">
            <div class="sr-1-1"><span style="float:left;font-size:12px;"><span>${topMarket}</span>&nbsp;&nbsp;&nbsp;&nbsp;<span>${storeRemark}</span></span><span style="position:absolute;left:50%;font-size:12px;"><b>${fatherName}</b>&nbsp;&nbsp;&nbsp;&nbsp;<b>${storeName}</b></span></span></div>
        </div>
        <div class="blank"></div>
        <form method="post" id="myForm" action="/wape-web/api/core/centerService">
        <input type="hidden" name="serviceCode" value="MMZS24101" />
        <input type="hidden" name="storeId" value="${storeId}" />
        <input type="hidden" name="storeName" value="${storeName}" />
        <input type="hidden" name="fatherId" value="${fatherId}" />
        <input type="hidden" name="fatherName" value="${fatherName}" />
        <input type="hidden" name="fatherType" value="${fatherType}" />
        <div class="layout3-1" style="font-size:12px;">
            <div class="layout3-1-1">
                <table style="width:100%;">
                   <tr>
                       <td style="width:65px;"><span>合同编号：</span></td>
                       <td><input type="text" name="contractNum" placeholder="*必填项" id="require-1" style="border:none;border-bottom:1px solid #ccc;height:30px;width:100%;"></td>
                   </tr>
                </table>
            </div>
            <div class="hr"></div>
            <div class="layout3-1-1">
                <table style="width:100%;">
                   <tr>
                       <td style="width:65px;"><span>合同名称：</span></td>
                       <td><input type="text" name="contractName" placeholder="*必填项" id="require-2" style="border:none;border-bottom:1px solid #ccc;height:30px;width:100%;"></td>
                   </tr>
                </table>
            </div>
            <div class="hr"></div>
            <div class="layout3-1-1">
                <table style="width:100%;">
                   <tr>
                       <td style="width:65px;"><span>租售状态：</span></td>
                       <td>
                          <select name="tenantState" style="font-size:12px;width:100%;">
                              <option value="1">已出租</option>
                              <option value="2">已出售</option>
                              <option value="3" selected>等待出租</option>
                              <option value="4">等待出售</option>
                              <option value="5">自营物业</option>
                              <option value="6">出租预订+已交定金</option>
                              <option value="7">出售预定+已交定金</option>
                              <option value="8">出租预定+未交定金</option>
                              <option value="9">出售预定+未交定金</option>
                              <option value="10">公共设施</option>
                              <option value="11">物业维修中</option>
                          </select>
                       </td>
                   </tr>
                </table>
            </div>
            <div class="hr"></div>
            <div class="layout3-1-1">
                <table style="width:100%;">
                   <tr>
                       <td style="width:65px;"><span>租金方式：</span></td>
                       <td>
                          <select name="contractMode" style="font-size:12px;width:100%;">
                             <option value="10">保证金+整年租</option>
                             <option value="20">保证金+半年租</option>
                             <option value="30">保证金+月度租金</option>
                             <option value="40">保证金+季度租金</option>
                          </select>
                       </td>
                   </tr>
                </table>
            </div>
            <div class="hr"></div>
            <div class="layout3-1-1">
                <table style="width:100%;">
                   <tr>
                       <td style="width:65px;"><span>租赁周期：</span></td>
                       <td>
                          <select name="contractType" style="font-size:12px;width:100%;">
                             <option value="10">半年</option>
                             <option value="20">一年</option>
                             <option value="30">两年</option>
                             <option value="40" selected>三年</option>
                             <option value="50">五年</option>
                             <option value="60">十年</option>
                             <option value="70">二十年</option>
                             <option value="80">二十六年</option>
                          </select>
                       </td>
                   </tr>
                </table>
            </div>
            <div class="hr"></div>
            <div class="layout3-1-1">
                <table style="width:100%;">
                   <tr>
                       <td style="width:65px;"><span>合同状态：</span></td>
                       <td>
                          <select name="contractState" style="font-size:12px;width:100%;">
                             <option value="10">正式合同执行中</option>
                             <option value="20">临时协议</option>
                             <option value="30">合同终止</option>
                             <option value="40">挪铺位</option>
                          </select>
                       </td>
                   </tr>
                </table>
            </div>
            <div class="hr"></div>
            <div class="layout3-1-1">
                <table style="width:100%;">
                   <tr>
                       <td style="width:90px;"><span>合同签订时间：</span></td>
                       <td><input type="text" id="demo" name="tenantday" readonly="readonly" placeholder="请选择时间" style="border:none;border-bottom:1px solid #ccc;height:30px;width:100%;"></td>
                   </tr>
                </table>
            </div>
            <div class="hr"></div>
            <div class="layout3-1-1">
                <table style="width:100%;">
                   <tr>
                       <td style="width:90px;"><span>合同生效时间：</span></td>
                       <td><input type="text" id="demo2" name="hiredate" readonly="readonly" placeholder="请选择时间" style="border:none;border-bottom:1px solid #ccc;height:30px;width:100%;"></td>
                   </tr>
                </table>
            </div>
            <div class="hr"></div>
            <div class="layout3-1-1">
                <table style="width:100%;">
                   <tr>
                       <td style="width:90px;"><span>合同失效时间：</span></td>
                       <td><input type="text" id="demo3" name="closingday" readonly="readonly" placeholder="请选择时间" style="border:none;border-bottom:1px solid #ccc;height:30px;width:100%;"></td>
                   </tr>
                </table>
            </div>
            <div class="hr"></div>
            <div class="layout3-1-1">
                <table style="width:100%;">
                   <tr>
                       <td style="width:65px;"><span>商户姓名：</span></td>
                       <td><input type="text" name="tenantName" placeholder="*必填项" id="require-3" style="border:none;border-bottom:1px solid #ccc;height:30px;width:100%;"></td>
                   </tr>
                </table>
            </div>
            <div class="hr"></div>
            <div class="layout3-1-1">
                <table style="width:100%;">
                   <tr>
                       <td style="width:65px;"><span>电 &nbsp;&nbsp;&nbsp;&nbsp;&ensp;话：</span></td>
                       <td><input type="text" name="tenantPhone" placeholder="*必填项" id="require-4" style="border:none;border-bottom:1px solid #ccc;height:30px;width:100%;"></td>
                   </tr>
                </table>
            </div>
            <div class="hr"></div>
            <div class="layout3-1-1">
                <table style="width:100%;">
                   <tr>
                       <td style="width:75px;"><span>身份证号码：</span></td>
                       <td><input type="text" name="idNum" placeholder="*必填项" id="require-5" style="border:none;border-bottom:1px solid #ccc;height:30px;width:100%;"></td>
                   </tr>
                </table>
            </div>
            <div class="hr"></div>
            <div class="layout3-1-1">
                <table style="width:100%;">
                   <tr>
                       <td style="width:65px;"><span>商铺名称：</span></td>
                       <td><input type="text" name="tenantCompanyName" placeholder="*必填项" id="require-6" style="border:none;border-bottom:1px solid #ccc;height:30px;width:100%;"></td>
                   </tr>
                </table>
            </div>
            <div class="blank-b"></div>
            <div class="layout3-1-1" style="height:auto;line-height:auto; overflow:hidden;">
               <div class="blank-z"></div>
               <textarea name="contractRemark" rows="" cols="" placeholder="备注：" style="width:99%;"></textarea>
            </div>
        </div>
        <div class="blank-zb"></div>
        <div class="ci-1">
           <div class="ci-1-1"><a href="javascript:void(0)" class="submit" id="submit">确定录入</a></div>
        </div>
        </form>
        <div class="space"></div>
    </div>
</div>
</body>
<script type="text/javascript">
     /*错误提示*/
     $(function(){
         var error = "${requestScope.returnMsg}";
         if(error != "" && error != "成功!"){
             layer.msg(error,{shadeClose:true,shade:0.1,time:2000});
         }
     });
     /*提交*/
     $(function(){
    	 $("#submit").click(function(){
    		 layer.confirm('确认提交？',{
                 icon: 3,
                 title:'提交'
             },function(sure){
                 layer.closeAll();
                 $("#myForm").submit();
             });
    	 });
     });
     /*提交表单*/
     $("#myForm").submit(function(){
         var a = $("#require-1").val();
         var b = $("#require-2").val();
         var c = $("#require-3").val();
         var d = $("#require-4").val();
         var e = $("#require-5").val();
         var f = $("#require-6").val();
         var g = $("#demo").val();
         var h = $("#demo2").val();
         var i = $("#demo3").val();
         var time = $("#demo").val();
         var starttime = $('#demo2').val();
         var endtime = $('#demo3').val();
         var time2 = new Date(time.replace("-", "/").replace("-", "/"));
         var start = new Date(starttime.replace("-", "/").replace("-", "/"));
         var end = new Date(endtime.replace("-", "/").replace("-", "/"));
         var patrn =/^1[3,4,5,6,7,8]\d{9}$/;
         var IDCard=/^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/; 
         if(a == ""){
             layer.msg("请输入合同编号",{shadeClose:true,shade:0.1,time:2000});
             return false;
         }
         else if(a.match(/^[\u4e00-\u9fa5]{0,}$/)){
             layer.msg("合同编号不能有汉字",{shadeClose:true,shade:0.1,time:2000});
             return false;
         }
         else if(b == ""){
             layer.msg("请输入合同名称",{shadeClose:true,shade:0.1,time:2000});
             return false;
         }
         else if(g == ""){
             layer.msg("请选择合同签订时间",{shadeClose:true,shade:0.1,time:2000});
             return false;
         }
         else if(h == ""){
             layer.msg("请选择合同生效时间",{shadeClose:true,shade:0.1,time:2000});
             return false;
         }
         else if(i == ""){
             layer.msg("请选择合同生效时间",{shadeClose:true,shade:0.1,time:2000});
             return false;
         }
         else if(start < time2) {
             layer.msg("生效时间不能小于签订时间!",{shadeClose:true,shade:0.1,time:2000});
             return false;
         }
         else if(end < start) {
             layer.msg("失效时间不能小于生效时间!",{shadeClose:true,shade:0.1,time:2000});
             return false;
         }
         else if(c == ""){
             layer.msg("请输入商户姓名",{shadeClose:true,shade:0.1,time:2000});
             return false;
         }
         else if(!c.match(/^[\u4e00-\u9fa5]{0,}$/)){
             layer.msg("请输入汉字格式姓名",{shadeClose:true,shade:0.1,time:2000});
             return false;
         }
         else if(d == ""){
             layer.msg("请输入手机号",{shadeClose:true,shade:0.1,time:2000});
             return false;
         }
         else if(!patrn.test(d)){
             layer.msg("输入的手机号码不正确",{shadeClose:true,shade:0.1,time:2000});
             return false;
         }
         else if(e == ""){
             layer.msg("请输入身份证号码",{shadeClose:true,shade:0.1,time:2000});
             return false;
         }
         else if(!IDCard.test(e)){
             layer.msg("输入的身份证格式不正确",{shadeClose:true,shade:0.1,time:2000});
             return false;
         }
         else if(f == ""){
             layer.msg("请输入商铺名称",{shadeClose:true,shade:0.1,time:2000});
             return false;
         }
         else{
             layer.load();
             setTimeout(function(){
                 layer.closeAll();
                 layer.msg("网络异常，请重新尝试！",{shadeClose:true,shade:0.1,time:2000});
             }, 30000);
         }
     });
</script>
</html>


